import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  //解决“vite use `--host` to expose”
/*   base: './',
  server: {             
    host: '0.0.0.0',	
    // port: 8080,      
    open: true
  }, */
  server: {
    open: true,//启动项目自动弹出浏览器
    //port: 4000,//启动端口
    proxy: {
      '/api': {
        target: 'http://localhost:8080',	//实际请求地址
        changeOrigin: true, //代理时是否更改host
        rewrite: (path) => path.replace(/^\/api/, '')
      },
    }
  },
  resolve:{   
    //别名配置，引用src路径下的东西可以通过@如：import Layout from '@/layout/index.vue'
    alias:[   
      {
        find:'@',
        replacement:resolve(__dirname,'src') 
      }
    ]
  }
})
